package org.datascooter.test.example;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Transient;

import org.datascooter.impl.Data;

public class Contract extends Data {

	private static final long serialVersionUID = -2428096978987620414L;
	String texts;
	String tradeId;
	String offerId;
	@Transient
	private List<String> sectorNameList = new ArrayList<String>();
	private static final String STR = ";";

	public Contract() {
	}

	public Contract(String text, String tradeId, String offerId) {
		this.texts = text;
		this.tradeId = tradeId;
		this.offerId = offerId;
	}

	public String getTexts() {
		return texts;
	}

	public void setTexts(String text) {
		this.texts = text;
	}

	public String getTradeId() {
		return tradeId;
	}

	public void setTradeId(String tradeId) {
		this.tradeId = tradeId;
	}

	public String getOfferId() {
		return offerId;
	}

	public void setOfferId(String offerId) {
		this.offerId = offerId;
	}

	public String getSectorString() {
		StringBuilder builder = new StringBuilder();
		for (String sector : sectorNameList) {
			builder.append(sector);
			builder.append(STR);
		}
		return builder.toString();
	}

	public void setSectorString(String string) {
		sectorNameList.clear();
		String[] split = string.split(STR);
		for (String string2 : split) {
			sectorNameList.add(string2);
		}
	}

	public List<String> getSectorNameList() {
		return sectorNameList;
	}

	@Override
	public String toString() {
		return "Contract [texts=" + texts + ", tradeId=" + tradeId + ", offerId=" + offerId + "]";
	}
}
